#pragma once
#include"hashtable.h"
namespace egghead
{

	template<class K>
	struct HashFunc
	{
		size_t operator()(const K& k)
		{
			return (size_t)k;
		}
	};
	template<class K,class HASHFUNC = HashFunc<K>>
	class unordered_set
	{	
		struct GETVAL
		{
			const K& operator()(const K& kv) { return kv; }
		};
		typedef typename hashbucket::HashTable<const K, const K, HASHFUNC, GETVAL>::iterater iterater;
		typedef typename hashbucket::HashTable<const K, const K, HASHFUNC, GETVAL>::const_iterater const_iterater;
		
	public:
		pair<iterater,bool> insert(const K& k)
		{
			return hashtable.insert(k);
		}

		bool erase(const K& k)
		{
			return hashtable.erase(k);
		}
		iterater find(const K& k)
		{
			return hashtable.find(k);
		}

		unordered_set<K, HASHFUNC>operator ==(const unordered_set<K, HASHFUNC>& other)
		{
			hashtable = other.hashtable;
		}
		iterater begin() { return hashtable.begin(); }
		iterater end() { return hashtable.end(); }
		const_iterater begin()const { return hashtable.begin(); }
		const_iterater end()const { return hashtable.end(); }

	private:
		hashbucket::HashTable<const K, const K, HASHFUNC, GETVAL>hashtable;
	};
}
